<?php 
# 文件名称:online.view.php
# MetInfo在线反馈系统 
# Copyright (C) 长沙米拓信息技术有限公司 (http://www.metinfo.cn). All rights reserved.
class onlineView extends C_view
{
	function onlineView()
	{
		parent::C_view();
	}
	//加载模板
	function display($tpl)
	{		
		$SYS = &get_instance();
		$this->assignRef('message', $SYS->loader->getMessageQueue());
		$SYS->html->script('core.js');
		switch($tpl)
		{			
			case 'add':
			case 'edit':	
							if( $tpl=='add' )
							{
								$this->assignRef( 'title', C_text::_('online add'));
								$this->assignRef( 'subTitle',C_text::_('AddOnline'));
								$SYS->request->setVar( 'cid', array(0));
								$this->assign('apply', "add");
							}else
							{
								$this->assignRef( 'title', C_text::_('online edit'));
								$this->assignRef( 'subTitle',C_text::_('EditOnline'));
								$this->assign('apply', "edit");
							}														
							$this->assignRef('fdform', $this->get('Forms'));							
							$this->assignRef('item', $this->get('Item'));
							$this->assignRef('itemfield', $this->get('Itemfield'));
							$this->getJS();
							parent::display('online_edit');break;
			default:
							$this->assignRef( 'title', C_text::_('online manager'));
							$js_content="markRows();";
							$SYS->doc->addScriptDeclaration($js_content);
							$this->assignRef( 'items', $this->get('Items'));
							$this->assignRef( 'lists', $this->get('Lists'));
							$this->assignRef( 'pagination', $this->get('Pagination'));
							parent::display('online');
		}
	}
	//加载js库
	function getJS()
	{
		$js_content="
			window.addEvent('domready', function(){ 
				new Accordion($$('.pane-toggler'), 
				$$('.pane-slider'), 
				{
					onActive: function(toggler, i) 
					{ 
						toggler.addClass('pane-toggler-down');toggler.removeClass('pane-toggler'); 
					},
					onBackground: function(toggler, i) 
					{ 
						toggler.addClass('pane-toggler'); toggler.removeClass('pane-toggler-down'); 
					},
					duration: 300,opacity: false,alwaysHide: true
				}); 
			});
			function submitbutton(pressbutton) {
				var form = document.adminForm;
				if (pressbutton == 'cancel') {
					submitform( pressbutton );
					return;
				}
				var flag = false;
				$$('.must').each(function(el) {
					if(el.get('value')!='')
						flag=true;
				});
				if(!flag)
				{
					alert('".C_text::_('Must')."');
				}else if(form.form.value==0)
				{
					alert('".C_text::sprintf('Item10',C_text::_('Item9'))."');
				}else	
				{
					submitform( pressbutton );
				}
			}
			";
		$SYS = &get_instance();
		$SYS->doc->addScriptDeclaration($js_content);
		$SYS->html->script('mootools-more.js');
	}
}
# 本程序是一个开源系统,使用时请你仔细阅读使用协议,商业用途请自觉购买商业授权.
# Copyright (C) 长沙米拓信息技术有限公司 (http://www.metinfo.cn). All rights reserved.
?>